package etnorservice.etnor_service.mapper.projectMapper;



import etnorservice.etnor_service.domain.ProjectRequirement;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProjectRequirementMapper {
    @Insert("INSERT INTO project_requirements(project_id, requirement_type, min_requirement, recommended_requirement, display_order) " +
            "VALUES(#{projectId}, #{requirementType}, #{minRequirement}, #{recommendedRequirement}, #{displayOrder})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(ProjectRequirement requirement);

    @Select("SELECT * FROM project_requirements WHERE project_id = #{projectId} ORDER BY display_order")
    List<ProjectRequirement> findByProjectId(Long projectId);

    @Delete("DELETE FROM project_requirements WHERE project_id = #{projectId}")
    int deleteByProjectId(Long projectId);
}
